package yangsw87.basic;

public class J15_Ex73_Interface {

	public static void main(String[] args) {
		
		J15_FanServiceImpl fsrv = new J15_FanServiceImpl();
		
		J15_Fan f = new J15_Fan(3, true, 10, "yellow");

		f.setSpeed(fsrv.getSpeed(f));
		f.setOn(fsrv.getOn(f));
		
		System.out.println(f.toString());
	}

}

interface J15_FanService{
	int getSpeed(J15_Fan f);
	boolean getOn(J15_Fan f);
	
}

class J15_FanServiceImpl implements J15_FanService{

	@Override
	public int getSpeed(J15_Fan f) {
		String s ="";
		switch ((int)f.getSpeed()) {
		case 1:
			s="최저속도";
			break;
		case 2:
			s="중간속도";
			break;
		case 3:
			s="최고속도";
			break;
		default:
			break;
		}
		return f.getSpeed();
	}

	@Override
	public boolean getOn(J15_Fan f) {
		if (f.isOn() == true) {
			System.out.println("동작상태 : 동작중");
		} else {
			System.out.println("동작상태 : 정지");
		}
		return false;
	}

	
	
}

class J15_Fan{
	private int SLOW=1;
	private int MEDIUM=2;
	private int FAST=3;
	private int speed;
	private boolean on;
	private double radius;
	private String color;
	
	public J15_Fan() {
		speed = SLOW;
		on = false;
		radius = 5.0;
		color = "Blue";
	}

	

	public J15_Fan(int speed, boolean on, double radius, String color) {
		super();
		this.speed = speed;
		this.on = on;
		this.radius = radius;
		this.color = color;
	}



	public int getSpeed() {
		return speed;
	}

	public void setSpeed(int speed) {
		this.speed = speed;
	}

	public boolean isOn() {
		return on;
	}

	public void setOn(boolean on) {
		this.on = on;
	}

	public double getRadius() {
		return radius;
	}

	public void setRadius(double radius) {
		this.radius = radius;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	@Override
	public String toString() {
		return "J15_Fan [speed=" + speed + ", on=" + on + ", radius=" + radius
				+ ", color=" + color + "]";
	}
	
	
		
}
